<!--
 * @Description: 
 * @Author: 张文韬
 * @Date: 2022-09-06 14:09:26
 * @LastEditTime: 2024-07-16 13:29:42
 * @LastEditors: 张文韬
 * @Reference: 
-->
<template>
  <div>
    <DefaultTableList
      :ref="`doctorCheckRef`"
      :rowData="tableData"
      :formOptions="formOptions"
      :btns="btns"
      :tableConfig="columns"
      :controlEvents="{report}">
      <template #left>
        <div>标准总计：<span text-red font-bold>{{ 6225 }}</span> 元， 实收总计：<span text-red font-bold>{{ 4873.8 }}</span> 元</div>
      </template>
      <template #handleSlot="{ scope }">
        <el-button
          v-for="button in handleButtons"
          :key="button.text"
          :type="button.type"
          link
          size="small"
          @click="handleClick(button.text, scope.row)"
        >
          {{ button.text }}
        </el-button>
      </template>
    </DefaultTableList>
    <el-dialog
      v-model="dialogShow"
      title="选择保单"
      :width="1000"
      :before-close="closeDialog"
      :close-on-click-modal="false"
      :close-on-press-escape="false">
      <SelectOrder v-if="dialogShow" ref="selectOrderRef" :data="dialogFormCurrent" />
      <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="handleNext"> 下一步 </el-button>
        <el-button @click="handleCancel">关闭</el-button>
      </div>
    </template>
    </el-dialog>
  </div>
</template>

<script setup>

import { ref } from 'vue'
import { formOptions, btns } from './control'
import columns from './columns'
import DefaultTableList from '@/components/DefaultTableList/index.vue'
import SelectOrder from '../components/SelectOrder/index.vue'

const tableData = ref([
  { ip: '1111', id: 1 },
  { ip: '22222', id: 2 }
])

// buttom config --------------------------------------------------------------
const handleButtons = [
  { text: '详细', type: 'primary' },
  { text: '保单', type: 'primary' },
  { text: '签单', type: 'primary' },
  { text: '撤单', type: 'primary' }
]

const handleClick = (text, row) => {
  console.log(text, row)
}

const dialogShow = ref(false)
const dialogFormCurrent = ref({})
const report = (row) => {
  dialogFormCurrent.value = row
  openDialog()
}
const openDialog = () => {
  dialogShow.value = true
}

const closeDialog = () => {
  dialogShow.value = false
}

const handleCancel = () => {
  closeDialog()
  dialogFormCurrent.value = null
}

const selectOrderRef = ref(null)
const handleNext = () => {

}

</script>
